<?php
	include('class.db.php');
	$db = new db();
class log
{
	private $this->database = "vdab";
	private $this->logid;
	private $this->userid;
	private $this->error = "class.db:<br />";

	private function getName($uid)
	{
		$this->userid = $uid
		$this->error .= "GETNAME:<br />";
		$sql = "SELECT username from 'users' where id = '$this->userid'";
		$result = $db->query($this->database, $sql);
		if($result)
		{
			$this->error .= "The result was returned.<br />";
			return $result;
		}else
		{
			$this->error .= "The query did not deliver a result<br />";
			return false;
		}
	}
	public function set_log($uid, $msg)
	{
		$this->error .= "SET_LOG:<br />";
		$sql = "INSERT INTO log (msg,userID) VALUES ('$msg', $uid)";
		$result = $db->query($this->database, $sql);
		if($result)
		{
			$this->error .= "log insert succeeded.<br />";
			return true;
		} else
		{
			$this->error .= "log insert failed: " . mysql_error() ."<br />";
			return false;
		}
	}
	public function get_log($quer, $var)
	{
		switch($quer)
		{
			case 'all':
				$sql = "SELECT * from log";
				break;
			case 'user':
				$sql = "SELECT * from log WHERE userID = '$var'";
				break;
			case 'date':
				$sql = "SELECT * from log";
				break;
		}
		$this->error .= "GET_LOG:<br />";
		$result = $db->query($this->database, $sql);
		if($result)
		{
			$this->error .= "log collect succeeded<br />";
			return $result;
		} else
		{
			$this->error .= "log collect failed" . mysql_error() . "<br />";
			return false;
		}
	}
	public function error()
	{
		return $this->error;
	}
}